#include "UiNaviPathTopBar.h"
#ifdef MERGER_APP_TO_SHELL
	extern HINSTANCE g_SDHResModuleHandle;
#endif
UiNaviPathTopBar::UiNaviPathTopBar()
{
}

UiNaviPathTopBar::~UiNaviPathTopBar()
{
}

BOOL UiNaviPathTopBar::InitUiWin(void)
{
	BOOL bRtn = FALSE;
//	SetWindowLong(m_hWnd, GWL_USERDATA, (LONG) this);
	LoadiInterItem();
	InitImages();
	return bRtn;
}

void UiNaviPathTopBar::PaintWin(HDC hdc, RECT* prcWin, RECT* prcUpdate)
{
	m_TopBarBG->Draw(hdc, prcWin, false, false);
}

int UiNaviPathTopBar::OnLButtonDown(UINT fwKeys, int xPos, int yPos)
{
	return UiWin::OnLButtonDown(fwKeys, xPos, yPos);

}

int UiNaviPathTopBar::OnLButtonUp(UINT fwKeys, int xPos, int yPos)
{
	return UiWin::OnLButtonUp(fwKeys, xPos, yPos);

}

void UiNaviPathTopBar::LoadiInterItem()
{
//jdhuang 20120818
#ifndef MERGER_APP_TO_SHELL
	m_TopBarBG = ImagingHelper::GetImageObject(MzGetInstanceHandle(), 1063);
#else
	m_TopBarBG = ImagingHelper::GetImageObject(g_SDHResModuleHandle, 3063);
#endif
	
	RECT rtBtnClose = {719, 5, 800, 59};
	m_BtnTopBar[NAVIPATH_TOPBAR_CLOSE].SetPos(rtBtnClose.left, rtBtnClose.top, rtBtnClose.right-rtBtnClose.left, rtBtnClose.bottom-rtBtnClose.top);
	m_BtnTopBar[NAVIPATH_TOPBAR_CLOSE].SetID(8000);
#ifndef MERGER_APP_TO_SHELL
	m_BtnTopBar[NAVIPATH_TOPBAR_CLOSE].SetNormalImage(ImagingHelper::GetImageObject(MzGetInstanceHandle(),1059, true));
	m_BtnTopBar[NAVIPATH_TOPBAR_CLOSE].SetPressedImage(ImagingHelper::GetImageObject(MzGetInstanceHandle(),1060, true));
#else
	m_BtnTopBar[NAVIPATH_TOPBAR_CLOSE].SetNormalImage(ImagingHelper::GetImageObject(g_SDHResModuleHandle,3059, true));
	m_BtnTopBar[NAVIPATH_TOPBAR_CLOSE].SetPressedImage(ImagingHelper::GetImageObject(g_SDHResModuleHandle,3060, true));
#endif
	AddChild(&m_BtnTopBar[NAVIPATH_TOPBAR_CLOSE]);

	RECT rtBtnMenu = {0, 5, 81, 59};
	m_BtnTopBar[NAVIPATH_TOPBAR_MENU].SetPos(rtBtnMenu.left, rtBtnMenu.top, rtBtnMenu.right-rtBtnMenu.left, rtBtnMenu.bottom-rtBtnMenu.top);
	m_BtnTopBar[NAVIPATH_TOPBAR_MENU].SetID(8001);
#ifndef MERGER_APP_TO_SHELL
	m_BtnTopBar[NAVIPATH_TOPBAR_MENU].SetNormalImage(ImagingHelper::GetImageObject(MzGetInstanceHandle(),1061, true));
	m_BtnTopBar[NAVIPATH_TOPBAR_MENU].SetPressedImage(ImagingHelper::GetImageObject(MzGetInstanceHandle(),1062, true));
#else
	m_BtnTopBar[NAVIPATH_TOPBAR_MENU].SetNormalImage(ImagingHelper::GetImageObject(g_SDHResModuleHandle,3061, true));
	m_BtnTopBar[NAVIPATH_TOPBAR_MENU].SetPressedImage(ImagingHelper::GetImageObject(g_SDHResModuleHandle,3062, true));
#endif
	AddChild(&m_BtnTopBar[NAVIPATH_TOPBAR_MENU]);

}

BOOL UiNaviPathTopBar::InitImages()
{
	return TRUE;
}
void UiNaviPathTopBar::UpdateLanguage()
{
}
void UiNaviPathTopBar::DeleteImages()
{
	m_TopBarBG->UnloadImage();
}